FROM registry.cn-shenzhen.aliyuncs.com/tokengo/dotnet-aspnet:6.0-alpine AS base
WORKDIR /app
EXPOSE 80

FROM registry.cn-shenzhen.aliyuncs.com/tokengo/dotnet-sdk:6.0-alpine AS build
WORKDIR /src
COPY ["src/WoodenFish.BlazorServer/WoodenFish.BlazorServer.csproj", "src/WoodenFish.BlazorServer/"]
COPY ["src/WoodenFish.Component/WoodenFish.Component.csproj", "src/WoodenFish.Component/"]
RUN dotnet restore "src/WoodenFish.BlazorServer/WoodenFish.BlazorServer.csproj"
COPY . .
WORKDIR "/src/src/WoodenFish.BlazorServer"
RUN dotnet build "WoodenFish.BlazorServer.csproj" -c Release --os linux -o /app/build

FROM build AS publish
RUN dotnet publish "WoodenFish.BlazorServer.csproj" -c Release --os linux  -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WoodenFish.BlazorServer.dll"]